{include file="public/layout" /}

<body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="pc/left" /}
<div class="page min-hg-c-10" style="min-width:auto;margin-left:100px;">
    <div class="flexigrid htitx">
        <form id="handlepost">
            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                            <tr>
                                <th class="sign w10"><div class="tc"></div></th><th class="w10"><div class="tc">基础信息</div></th><th><div></div></th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit">
                        <label for="web_status_pc">站点状态</label>
                    </dt>
                    <dd class="opt">
                        <label class="curpoin"><input id="web_status_pc0" name="web_status_pc" value="0" type="radio" {if condition="empty($config.web_status_pc)"} checked="checked"{/if}>开启</label>
                        &nbsp;
                        <label class="curpoin"><input id="web_status_pc1" name="web_status_pc" value="1" type="radio" {if condition="!empty($config.web_status_pc)"} checked="checked"{/if}>关闭</label>
                    </dd>
                </dl>
                {include file="pc/settings_list" /}
            </div>

            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                            <tr>
                                <th class="sign w10"><div class="tc"></div></th><th class="w10"><div class="tc">首页TDK信息</div></th><th><div></div></th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit"> <label for="web_title">标题</label> </dt>
                    <dd class="opt ui-web_title ui-text">
                        <input type="text" id="web_title" name="web_title" value="{$config.web_title|default=''}" class="input-txt ui-input"/>
                        <p class="notic">标题（Title）一般不超过80个字符</p>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="web_keywords">关键词</label> </dt>
                    <dd class="opt ui-keyword ui-text">
                        <input type="text" id="web_keywords" name="web_keywords" value="{$config.web_keywords|default=''}" class="input-txt ui-input"/>
                        <p class="notic">关键词（KeyWords）一般不超过100个字符</p>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="web_description">描述</label> </dt>
                    <dd class="opt ui-web_description ui-text">
                        <textarea rows="5" cols="60" id="web_description" name="web_description" style="height: 60px;" class="ui-input keywordsTextarea" data-num="200" onkeyup="monitorInputStr();" onkeypress="monitorInputStr();">{$config.web_description|default=''}</textarea>
                        <p class="notic">描述（Description）建议不超过200个字符</p>
                        <p class="ui-big-text {empty name='$config.web_keywords'}none{/empty}" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</p>
                    </dd>
                </dl>
            </div>

            <div class="bot2" style="left: 150px;">
                <a href="JavaScript:void(0);" onclick="saveSettings();" class="ncap-btn-big ncap-btn-green w60">保存</a>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">
    var attrVarName = '';
    // 上传图片执行
    function uploadExecution(field) {
        // 定义当前点击项
        attrVarName = field;
        // 图片上传选择框
        GetUploadify(1, '', 'allimg', 'uploadCallbacks');
    }

    // 上传图片回调
    function uploadCallbacks(paths, clear, field) {
        attrVarName = field ? field : attrVarName;
        $('#' + attrVarName).val(paths);
        if (true == clear) {
            // 清除网站LOGO
            $('#' + attrVarName + '_src').hide().attr('src', paths);
            $('#' + attrVarName + '_y_line, #' + attrVarName + '_x_line').show();
        } else {
            // 上传网站LOGO
            $('#' + attrVarName + '_src').show().attr('src', paths);
            $('#' + attrVarName + '_y_line, #' + attrVarName + '_x_line').hide();
            // 上传其他图片
            $('#' + attrVarName + '_a').attr('href', paths);
            $('#' + attrVarName + '_i').attr('onmouseover', "layer_tips=layer.tips('<img src="+paths+" width=32 height=32>',this,{tips: [1, '#fff']});");
        }
    }

    // 提交保存配置
    function saveSettings() {
        layer_loading('正在处理');
        $.ajax({
            url : "{:url('Pc/settings', ['_ajax'=>1])}",
            type: 'POST',
            data: $('#handlepost').serialize(),
            dataType: 'JSON',
            success: function (res) {
                layer.closeAll();
                if (1 == res.code) {
                    layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                        window.location.reload();
                    });
                } else {
                    showErrorAlert(res.msg);
                    return false;
                }
            },
            error: function (e) {
                layer.closeAll();
                showErrorAlert(e.responseText);
                return false;
            }
        });
    }
</script>
{include file="public/footer" /}